package com.wenya.counter.data.db;

import android.content.Context;

import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.wenya.counter.data.bean.ScriptureBean;


@Database(entities = {ScriptureBean.class}, version = 1, exportSchema = false)
public abstract class CounterDatabase extends RoomDatabase {
    private static CounterDatabase instance;

    public static void initial(Context context) {
        if (instance == null) {
            synchronized (CounterDatabase.class) {
                if (instance == null) {
                    // 创建数据库名称和实例
                    instance = Room.databaseBuilder(context, CounterDatabase.class, "counter_data").allowMainThreadQueries().build();
                }
            }
        }
    }

    public static CounterDatabase getInstance() {
        return instance;
    }

    public abstract ScriptureDao basicDataDao();
}
